JavaScript

A5.ListBoxgetData Method

Syntax

A5.ListBox.getData(target)

Arguments

targetstringnumberobject

The index or value of the row of data to get. See A5.ListBox.getIndex.

Returns

dataobjectarray

The data for the row(s) in the list.

Description

Get the data for a given row in the list.

Example

// To get a pointer to the A5.ListBox class see {dialog.object}.getControl
// assume lObj is a pointer to an instance of the A5.ListBox class
var d = lObj.getData('ALFKI'); // "d" will equal the data for the row with a value of "ALFKI"

Example: Getting Data from a List Control

The target parameter can be a zero-based row number or a string representing the value returned by the List. For example, if the List is configured to return values from a 'Lastname' column, target could be set to 'Smith' to get data for the record with a 'Lastname' of 'Smith'.

The example below demonstrates getting data from a List Control in a UX Component. The first example uses the value returned by the List control to get the data. The second shows getting the data using the zero-based row number.

var listObj = {dialog.object}.getControl('list1');

//assume that the List was configured to return Lastname values. 
//Get the value of the 'Fistname' column for 'Lastname' of 'Smith'
var fn = listObj.getData('Smith').Firstname;

//get the value of 'Firstname' column from the 3rd row in the list
var fn = listObj.getData(2).Firstname; //target is zero based

See Also